package com.testyourshell.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.testyourshell.dao.BaseDAO;

public abstract class BaseServiceImpl<Entity extends Serializable, DAO extends BaseDAO<Entity>>
		implements BaseService<Entity> {

	@Autowired
	private DAO dao;

	@Transactional
	@Override
	public List<Entity> findAll() {
		return dao.findAll();
	}

	@Transactional
	@Override
	public Entity findById(Long id) {
		return dao.findById(id);
	}

	@Transactional
	@Override
	public void create(Entity createdEntity) {
		dao.create(createdEntity);
	}

	@Transactional
	@Override
	public Entity update(Entity updatedEntity) {
		return dao.update(updatedEntity);
	}

	@Transactional
	@Override
	public void delete(Entity deletedEntity) {
		dao.delete(deletedEntity);
	}

}
